<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../../assets/font/iconfont.css">
    <link rel="stylesheet" href="./util/vue-message.css">
    <style>
        body{
            padding-bottom: 800px;
        }
        .iconfont{
            font-size: 40px;
        }
        icon{
            font-family: "iconfont" !important;
            font-size: 40px;
        }
        icon-home{
            font-family: "iconfont" !important;
            font-size: 40px;
            display: block;
        }
        icon-home::before{
            content: "\e8ff";
        }
    </style>
</head>
<body>
    <input type="button" value="提示" id="tipBtn">
    <hr>
    <div id="app">
        <icon>&#xe8ff;</icon>
        <icon-home></icon-home>
        <hr>
        <input type="button" value="提示" @click="openTip()">
        <hr>
        <pre>{{ types }}</pre>
    </div>
    <script src="../../assets/axios/axios.js"></script>
    <script type="module">
        import { createApp } from "../../assets/vue3/vue.esm-browser.js";
        import config from "./config/config.js";
        import directive from "./config/directive.js";
        import msessage from "./util/vue-message.js";
        import api from "./api/api.js"
        // const app = createApp({
        //     data(){
        //         return {

        //         }
        //     }
        // })
        // app.use(config)
        // app.mount("#app")
        createApp({
            data(){
                return {
                    types:{}
                }
            },
            methods: {
                openTip() {
                    this.$showTip("提示消息","测试use函数的使用规则","info")
                },
                // initTypes(){
                //     this.$api.loadTypes()
                //             .then((data)=>{
                //                 this.types = data
                //             })
                // },
                async initTypes(){
                    this.types = await this.$api.loadTypes()
                }
            },
            created () {
                this.initTypes();
            },
        })
        .use(config)
        .use(directive)
        .use(msessage)
        .use(api)
        .mount("#app");

        let tipBtn = document.querySelector("#tipBtn");
        tipBtn.onclick=function(){
            msessage.showTip("提示消息","测试use函数的使用规则","info")
        }
    </script>
</body>
</html>